function game(playerAction) {
    let random = Math.random() * 3
    let computerAction 

    if (random < 1) {
        computerAction = 'rock'
    } else if (random < 2) {
        computerAction = 'scissors'
    } else {
        computerAction = 'paper'
    }

    if (playerAction == computerAction) {
        return 0
    } else if (
        (computerAction === 'rock' && playerAction === 'paper') || 
        (computerAction === 'paper' && playerAction === 'scissors') || 
        (computerAction === 'scissors' && playerAction === 'rock')
    ) {
        return 1
    } else {
        return -1
    }
}

module.exports = game